< previous page page_358 next page >

Page 358
IUnknown * or LPUNKNOWNA pointer to an interface. Your Visual Basic declaration for this type should be ByVal As Object. Why? Because the object variable contains the pointer to the object, and you want to pass that pointer as a parameter.

IUnknown **, LPUNKNOWN *

A pointer to a pointer to an interface. The ** may be confusing at firstyou know that one * means a pointer. The ** means a pointer to a variable that contains a pointer. The Visual Basic object variable contains a pointer. You can obtain a pointer to that variable using the VarPtr operator or by passing the parameter by reference. Thus, your Visual Basic declaration for this type of parameter will typically be As Object (no ByVal). API functions typically use this type of parameter when they are going to load your variable with a new interface to an object.

COM is one of those technologies that are quite simple once you understand them, but getting to understand them can be very difficult. A complete discussion of COM and object technology is beyond the scope of this tutorial.5
This concludes our introduction to translating C header files to Visual Basic. It's a subject that will be covered further in the puzzles and in the tutorials that follow.
7017a6ead0e3c4111b47a554df321e9f.gif 7017a6ead0e3c4111b47a554df321e9f.gif
5 The subject is covered at length in my book Dan Appleman's Developing COM Components with Visual Basic 6.0: A Guide to the Perplexed.

 
< previous page page_358 next page >